#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Classifier.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class Classifier;
class Operation;
class Property;
class ProtocolStateMachine;
class Reception;

/// <summary>
/// Interface
/// Interfaces declare coherent services that are implemented by
/// BehavioredClassifiers that implement the Interfaces via InterfaceRealizations.
/// </summary>
class UMLMODEL_EXPORT Interface : public Classifier {

public: // Constructors and destructors
    explicit Interface(const QString& umlType="uml::Interface");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// nestedClassifiers getter
    /// References all the Classifiers that are defined (nested) within the Interface.
    /// </summary>
    vector<shared_ptr<Classifier>>& nestedClassifiers();

    /// <summary>
    /// ownedAttributes getter
    /// The attributes (i.e., the Properties) owned by the Interface.
    /// </summary>
    vector<shared_ptr<Property>>& ownedAttributes();

    /// <summary>
    /// ownedOperations getter
    /// The Operations owned by the Interface.
    /// </summary>
    vector<shared_ptr<Operation>>& ownedOperations();

    /// <summary>
    /// ownedReceptions getter
    /// Receptions that objects providing this Interface are willing to accept.
    /// </summary>
    vector<shared_ptr<Reception>>& ownedReceptions();

    /// <summary>
    /// protocol getter
    /// References a ProtocolStateMachine specifying the legal sequences of the
    /// invocation of the BehavioralFeatures described in the Interface.
    /// </summary>
    shared_ptr<ProtocolStateMachine> protocol() const;

    /// <summary>
    /// protocol setter
    /// References a ProtocolStateMachine specifying the legal sequences of the
    /// invocation of the BehavioralFeatures described in the Interface.
    /// </summary>
    void setProtocol(shared_ptr<ProtocolStateMachine> value);

    /// <summary>
    /// redefinedInterfaces getter
    /// References all the Interfaces redefined by this Interface.
    /// </summary>
    vector<shared_ptr<Interface>>& redefinedInterfaces();

private: // Fields
    /// <summary>
    /// nestedClassifiers
    /// References all the Classifiers that are defined (nested) within the Interface.
    /// </summary>
    vector<shared_ptr<Classifier>> nestedClassifiers_;

    /// <summary>
    /// ownedAttributes
    /// The attributes (i.e., the Properties) owned by the Interface.
    /// </summary>
    vector<shared_ptr<Property>> ownedAttributes_;

    /// <summary>
    /// ownedOperations
    /// The Operations owned by the Interface.
    /// </summary>
    vector<shared_ptr<Operation>> ownedOperations_;

    /// <summary>
    /// ownedReceptions
    /// Receptions that objects providing this Interface are willing to accept.
    /// </summary>
    vector<shared_ptr<Reception>> ownedReceptions_;

    /// <summary>
    /// protocol
    /// References a ProtocolStateMachine specifying the legal sequences of the
    /// invocation of the BehavioralFeatures described in the Interface.
    /// </summary>
    shared_ptr<ProtocolStateMachine> protocol_;

    /// <summary>
    /// redefinedInterfaces
    /// References all the Interfaces redefined by this Interface.
    /// </summary>
    vector<shared_ptr<Interface>> redefinedInterfaces_;

};

} // namespace uml
